import VueRouter from "vue-router";
import Vue from "vue";

Vue.use(VueRouter)

const router = new VueRouter({
    mode:'history',
    routes:[
        {
            path:'/',
            redirect:'/home'
        },
        {
            path:'/Home',
            component:()=>import('@/pages/Home'),
            redirect:'/home/movie',
            children:[
                {
                    path:'movie',
                    name:'Movie',
                    component:()=>import('@/pages/Home/Movie')
                },
                {
                    path:'music',
                    component:()=>import('@/pages/Home/Music'),
                    children:[
                        {
                            path:'musicDetail',
                            name:'MusicDetail',
                            component:()=>import('@/pages/Home/Music/MusicDetail'),
                        //    1.props传params参数（props是布尔类型的值）
                        //     props:true

                        //    2.props传query传参（props是对象类型的值）
                        //     props:{
                        //         name:'张杰',
                        //         age:24
                        //     },

                        //    3.props是函数类型的值
                            props:(route)=>({
                                ...route.query
                            })
                        }
                    ]
                }
            ]
        },
        {
            path:'/Login',
            component:()=>import('@/pages/Login')
        }
    ]
})

export default router